package edu.sctu.renpingan.day20150526.ListAndHashmap;

import edu.sctu.renpingan.day20150518.Student;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created by user18 on 2015/5/26.
 */
public class GetListAndHashmap {
    public List<HashMap<String,List<Student>>> GetListAndHashmap(int teachersize,int studentsize){
        List<HashMap<String,List<Student>>> list = new ArrayList<HashMap<String,List<Student>>>();
        HashMap<String,List<Student>> map = new HashMap<String,List<Student>>();


        for (int i = 0; i < studentsize; i++) {
            Student student = new Student();
            List<Student> list1 = new ArrayList<Student>();
            student.adress = "中国";
            student.name = "张三"+i;
            student.age = 16;
            int grade = student.grade = 89+i;
            if(grade >= 90){
                student.is_sanhao = true;
            }else{
                student.is_sanhao = false;
            }
            list1.add(student);
            map.put("老师"+i,list1);
        }
        list.add(map);
        for (int i = 0; i < studentsize; i++) {
            Student student = new Student();
            List<Student> list2 = new ArrayList<Student>();
            student.adress = "美国";
            student.name = "李四"+i;
            student.age = 16+i;
            int grade = student.grade = 89+i;
            if(grade >= 90){
                student.is_sanhao = true;
            }else{
                student.is_sanhao = false;
            }
            list2.add(student);
            map.put("老师2"+i,list2);
        }

        list.add(map);
        for (int i = 0; i < studentsize; i++) {

            boolean choice = list.get(0).get("老师"+i).get(0).is_sanhao;
             if(choice){
                 System.out.println(list.get(0).get("老师"+i).get(0).name);
             }

            boolean choice1 = list.get(1).get("老师2"+i).get(0).is_sanhao;
            if(choice1){
                System.out.println(list.get(1).get("老师2"+i).get(0).name);
            }
        }

        return list;
    }
}

